package Testes;

import static org.junit.Assert.*;

import org.junit.Test;

import DAO.HistoricoDaoImplArquivo;
import DAO.HistoricoTurmaDaoImplArquivo;
import Pojo.Aluno;
import Pojo.Disciplina;
import Pojo.Historico;
import Pojo.HistoricoTurma;
import Pojo.Turma;

public class HistoricoDaoImplArquivoTest {

	@Test
	public void insercaoNaListaDaCerto() throws Exception{
		Aluno aluno = new Aluno(1,"Thiago","09989403643");
		Disciplina disciplina = new Disciplina(1, "AEDS2", "hash, quicksort, sorts", 72);
		Historico historico = new Historico(10,80,5, aluno,disciplina);
		assertEquals(true, new HistoricoDaoImplArquivo().adicionarHistorico(historico));
	}
	
	@Test
	public void insercaoNaListaDaErrado() throws Exception{
		Aluno aluno = new Aluno(1,"Thiago","09989403643");
		Disciplina disciplina = new Disciplina(1, "AEDS2", "hash, quicksort, sorts", 72);
		Historico historico = new Historico(1,80,5, aluno,disciplina);
		assertEquals(false, new HistoricoDaoImplArquivo().adicionarHistorico(historico));
	}
	
	@Test
	public void remocaoNaListaDaCerto() throws Exception{
		Aluno aluno = new Aluno(1,"Thiago","09989403643");
		Disciplina disciplina = new Disciplina(1, "AEDS2", "hash, quicksort, sorts", 72);
		Historico historico = new Historico(1,80,5, aluno,disciplina);
		assertEquals(true, new HistoricoDaoImplArquivo().removerHistorico(historico));
	}
	
	@Test 
	public void procurarHistoricoPorAlunoEDisciplinaDaCerto() throws Exception{
		HistoricoDaoImplArquivo historicoDao = new HistoricoDaoImplArquivo();
		assertNotNull(historicoDao.procurarPorAlunoEDisciplina(1, 1));
	}

	@Test 
	public void procurarHistoricoPorAlunoEDisciplinaDaErrado() throws Exception{
		HistoricoDaoImplArquivo historicoDao = new HistoricoDaoImplArquivo();
		assertNull(historicoDao.procurarPorAlunoEDisciplina(23, 1));
	}
}
